#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "tactics.h"
#include "ast.h"
#include "internal.h"
#include "backend.h"
#include "yy.h"

struct translationunit *unit = NULL;

int main(int argc, char **argv)
{
	srand((unsigned)time(NULL));

	puts("Welcome to use Tactics.");

	if (argc != 2) {
		puts("Usage: tactics <filename>");
		exit(1);
	}

	yyin = fopen(argv[1], "r");

	yyparse();
	puts("Parsed.");

	validate(unit);
	puts("Validated.");

	puts("Entering the game....\n");

	interpret(unit);

	free_translationunit(unit);

	return 0;
}
